<layout name="layout"/>

<!-- 商品列表 -->
<form method="post" action="__SELF__" submit="" >
    <div class="list-div" id="listDiv">
        <table cellpadding="3" cellspacing="1">
            <tr>
                <?php foreach ($gaData as $k => $v):?>
                <th><?php echo $k; ?></th>
                <?php endforeach;?>
                <th width="120">库存量</th>
                <th width="60">操作</th>
            </tr>
            <?php if($gnData):?>
            <?php foreach($gnData as $k0 => $v0):?>
                <tr class="tron">
                    <?php
                    $gaCount = count($gaData);
                    foreach ($gaData as $k => $v):?>
                    <td>
                        <select name="goods_attr_id[]">
                            <option value="">请选择...</option>
                                <?php foreach($v as $k1 => $v1):
                                $_attr = explode(',',$v0['goods_attr_id']);
                                if(in_array($v1['id'],$_attr))
                                    $select = 'selected="selected"';
                                else
                                    $select = '';
                                ?>
                                <?php ?>
                            <option <?php echo $select; ?> value="<?php echo $v1['id'];?>"><?php echo $v1['attr_value']; ?></option>
                        <?php endforeach; ?>
                        </select>
                    </td>
                    <?php endforeach;?>
                    <td><input type="text" name="goods_number[]" value="<?php echo $v0['goods_number'];?>"/></td>
                    <td><input onclick="addNewAttr(this);" type="button" value="+"/></td><!--<?php echo $k0==0?'+':'-'; ?>-->
                </tr>
                <?php endforeach; ?>
            <?php endif;?>
            <tr id="submit">
                <td align="center" colspan="<?php echo $gaCount+2; ?>"><input type="submit" value="提交"/></td>
            </tr>
        </table>

        <!-- 分页开始 -->
        <table id="page-table" cellspacing="0">
            <tr>
                <td width="80%">&nbsp;</td>
                <td align="center" nowrap="true">
                    {$data['page']}
                </td>
            </tr>
        </table>
        <!-- 分页结束 -->
    </div>
</form>

<div id="footer">
    共执行 7 个查询，用时 0.028849 秒，Gzip 已禁用，内存占用 3.219 MB<br />
    版权所有 &copy; 2005-2012 上海商派网络科技有限公司，并保留所有权利。</div>

<!--引入时间插件-->
<link href="__PUBLIC__/datetimepicker/jquery-ui-1.9.2.custom.min.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/datetimepicker/jquery-ui-1.9.2.custom.min.js"></script>
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/datetimepicker/datepicker-zh_cn.js"></script>
<link rel="stylesheet" media="all" type="text/css" href="__PUBLIC__/datetimepicker/time/jquery-ui-timepicker-addon.min.css" />
<script type="text/javascript" src="__PUBLIC__/datetimepicker/time/jquery-ui-timepicker-addon.min.js"></script>
<script>
    $.timepicker.setDefaults($.timepicker.regional['zh-CN']);
    $("#fa").datetimepicker();
    $("#ta").datetimepicker();
</script>
<script>
    function addNewAttr(a) {
        var tr = $(a).parent().parent();
        if($(a).val() == '[+]') {
            var newTr = tr.clone();
            newTr.find(":button").val('-');
            $('#submit').before(newTr);
        } else {
            tr.remove();
        }
    }
</script>
</body>
</html>